package ydj.cloud.example.nacosdiscoveryconsumerexample.controller;

import ydj.cloud.example.nacosdiscoveryconsumerexample.client.ProviderFeiginClient;
//import ydj.cloud.example.nacosdiscoveryconsumerexample.service.EchoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class TestController {

    @Autowired
    private RestTemplate restTemplate;

//    @Autowired
//    private EchoService echoService;

    @Autowired
    private ProviderFeiginClient providerFeiginClient;

    @GetMapping(value = "/test")
    public String test() {
        return restTemplate.getForObject("http://nacos-discovery-provider-example/echo", String.class);
    }

    @GetMapping(value = "/echo")
    public String echo() {
//        return echoService.echo();
        return null;
    }

    @GetMapping(value = "hello")
    public String hello() {
        providerFeiginClient.echo();
        return "hello";
    }
}
